using UnityEngine;
using System.Collections;

public class AttackBehaviour : MonoBehaviour {
	
	public float speed;
	// Use this for initialization
	
	void Start()
	{
		Destroy(gameObject,20);
	}
	
	
	// Update is called once per frame
	void Update () 
	{
		float posX = transform.position.x + speed *Time.deltaTime;
		transform.position = new Vector3(posX,transform.position.y,transform.position.z);
	}
	
	void OnTriggerEnter(Collider enemy)
	{
		if(enemy.tag == "Enemy")
		{
			enemy.SendMessage("removeLife");
			Destroy(gameObject);
		}
	}
}
